<?php

namespace brand;

use brand\logic\Config;
use surface\Component;
use think\Exception;

/**
 * @method static \brand\build\Builder  Builder($title = '', $method = 'input')
 */
class Brand
{

    public static function __callStatic($name, $arguments)
    {
        return self::make($name, $arguments);
    }


    public static function make($name, $param = [])
    {

        $class = Config::BRAND_BUILD_NAMESPACE . ucfirst(strtolower($name));
        if (class_exists($class)) {
            if (count($param) === 0) $param = [null];
            return (new \ReflectionClass($class))->newInstanceArgs($param);
        }

    }

    public static function Component()
    {
        return new Component();
    }
}